<?php
class OrderModel extends Model {
	public function addOrder($data) {
		$order = M('order');
		if ($order -> create($data)) {
			return $order -> add();
		}
		return false;
	}
	public function getOrderPageList($p,$status,$type = 0){
			$order = D('Order');
			if($type!=0){
				$where['type'] = $type;
			}
			
			$where['status']=$status;
			import('@.ORG.Page');
			$count = $order->where($where)->count();
			$Page = new Page($count,10);
			$Page->parameter = 'type='.$type;
			$show  = $Page->show();
			$orderlist = $order->where($where)->page($p.',10')->select();
			return array('page'=>$show ,'orderlist'=>$orderlist);
		}
	public function Delete($id,$data){
		$del=M("Order");
		$cdata['oid']=$id;
		$deled=$del->where($cdata)->save($data);
		return $deled;
	}

}
